import { ArticleItem } from './../../types/data.d';
import { ArticleAction } from "@/types/store"

interface IState {
  articles: ArticleItem[]
}

const initState: IState = {
  articles: []
}

export default function article(preState = initState, action: ArticleAction): IState {
  switch(action.type) {
    case 'ARTICLE_SAVE':
      return {
        ...preState,
        articles: action.payload
      }
    default:
      return preState
  }
}